﻿<Fluent:RibbonWindow
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent" 
	xmlns:ext="clr-namespace:WPFExtensions.ViewModel.Commanding;assembly=WPFExtensions" 
	xmlns:vm="clr-namespace:XmlStudio.ViewModel" 
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	xmlns:loc="clr-namespace:Tomers.WPF.Localization;assembly=Tomers.WPF.Localization" xmlns:Controls="clr-namespace:XmlStudio.Controls" mc:Ignorable="d"
	ext:CommandSinkBinding.CommandSink="{Binding}"
	loc:Translate.Uid="XmlStudio.MainWindow"
	MinWidth="640"
	MinHeight="480"
	Title="{Binding TitleBar}" Width="1280" Height="800" Icon="Resources\Icon.ico"
	x:Class="XmlStudio.MainWindow"
	ResizeMode="CanResizeWithGrip"
	FlowDirection="LeftToRight">
    <Fluent:RibbonWindow.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Office2010/Silver.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Fluent:RibbonWindow.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="3" />
            <RowDefinition Height="150" />
        </Grid.RowDefinitions>

        <!-- Menu -->
        <Fluent:Ribbon Grid.Row="0" AutomaticStateManagement="True" x:Name="ribbon" BackstageBrush="{StaticResource BackstageBrush}">
            <!-- Toolbar -->
            <Fluent:Ribbon.ToolBarItems>
                <Fluent:Button Size="Small" Icon="Images/Help.png">
                    <!--<Fluent:Button.ToolTip>
                        <Fluent:ScreenTip Title="XmlStudio" 
										  Text="Help"
										  HelpTopic="http://fluent.codeplex.com"
										  DisableReason="Disable reason reason."
										  IsRibbonAligned="True" />
                    </Fluent:Button.ToolTip>-->
                </Fluent:Button>
            </Fluent:Ribbon.ToolBarItems>

            <Fluent:Ribbon.QuickAccessItems>
                <Fluent:QuickAccessMenuItem IsChecked="True">
                    <Fluent:QuickAccessMenuItem.Target>
                        <Fluent:Button Icon="Icons\undo.ico" x:Name="undoButton" Command="Undo" loc:Translate.Uid="Ribbon.QuickAccessMenu.Undo" Text="{loc:Translate Undo}">
                        </Fluent:Button>
                    </Fluent:QuickAccessMenuItem.Target>
                </Fluent:QuickAccessMenuItem>
                <Fluent:QuickAccessMenuItem IsChecked="True">
                    <Fluent:QuickAccessMenuItem.Target>
                        <Fluent:Button Icon="Icons\redo.ico" x:Name="redoButton" Command="Redo" loc:Translate.Uid="Ribbon.QuickAccessMenu.Redo" Text="{loc:Translate Redo}" />
                    </Fluent:QuickAccessMenuItem.Target>
                </Fluent:QuickAccessMenuItem>
                <Fluent:QuickAccessMenuItem>
                    <Fluent:QuickAccessMenuItem.Target>
                        <Fluent:Button Icon="Icons\fileopen.ico" Command="Open" loc:Translate.Uid="Ribbon.QuickAccessMenu.Open" Text="{loc:Translate Open}" />
                    </Fluent:QuickAccessMenuItem.Target>
                </Fluent:QuickAccessMenuItem>
                <Fluent:QuickAccessMenuItem Target="{Binding ElementName=SaveButtonBackstage}" />
                <Fluent:QuickAccessMenuItem Target="{Binding ElementName=PrintButton}" />
            </Fluent:Ribbon.QuickAccessItems>

            <!-- Home -->
            <Fluent:RibbonTabItem x:Name="homeTabItem" loc:Translate.Uid="Ribbon.Tab.Home" Header="{loc:Translate Home}">
                <!-- File -->
                <!--<Fluent:RibbonGroupBox loc:Translate.Uid="Ribbon.Tab.Home.File"  Header="{loc:Translate File}">
					<Fluent:Button loc:Translate.Uid="Ribbon.Tab.Home.File.Open" x:Name="openButton" Command="Open" Fluent:KeyTip.Keys="O" Text="{loc:Translate Open}" Icon="Icons\fileopen.ico" LargeIcon="Icons\fileopen.ico" SizeDefinition="Large">
						<Fluent:Button.ToolTip>
							<Fluent:ScreenTip loc:Translate.Uid="Ribbon.Tab.Home.Open.ScreenTip" Title="{loc:Translate 'Open (Ctrl+O)'}" Text="{loc:Translate 'Open file.'}" />
						</Fluent:Button.ToolTip>
					</Fluent:Button>
					<Fluent:Button Fluent:KeyTip.Keys="S" x:Name="newButton" loc:Translate.Uid="Ribbon.Tab.Home.File.New" Text="{loc:Translate New}" Icon="Icons\filenew.ico" SizeDefinition="Middle,Small">
						<Fluent:Button.ToolTip>
							<Fluent:ScreenTip loc:Translate.Uid="Ribbon.Tab.Home.New.ScreenTip" Title="{loc:Translate 'New (Ctrl+N)'}" Text="{loc:Translate 'New file.'}" />
						</Fluent:Button.ToolTip>
					</Fluent:Button>
					<Fluent:Button Fluent:KeyTip.Keys="S" x:Name="saveButton" loc:Translate.Uid="Ribbon.Tab.Home.File.Save" Command="vm:XmlViewModel.SaveDocumentCommand" Text="{loc:Translate Save}" Icon="Icons\filesave.ico" SizeDefinition="Middle,Small">
						<Fluent:Button.ToolTip>
							<Fluent:ScreenTip loc:Translate.Uid="Ribbon.Tab.Home.Save.ScreenTip" Title="{loc:Translate 'Save (Ctrl+S)'}" Text="{loc:Translate 'Save file.'}" />
						</Fluent:Button.ToolTip>
					</Fluent:Button>
					<Fluent:Button Fluent:KeyTip.Keys="S" loc:Translate.Uid="Ribbon.Tab.Home.File.SaveAs" Command="vm:XmlViewModel.SaveDocumentAsCommand" Text="{loc:Translate 'Save as'}" Icon="Icons\filesaveas.ico" SizeDefinition="Middle,Small">
						<Fluent:Button.ToolTip>
							<Fluent:ScreenTip loc:Translate.Uid="Ribbon.Tab.Home.SaveAs.ScreenTip" Title="{loc:Translate 'Save As'}" Text="{loc:Translate 'Save file as...'}" />
						</Fluent:Button.ToolTip>
					</Fluent:Button>
				</Fluent:RibbonGroupBox>-->

                <Fluent:RibbonGroupBox loc:Translate.Uid="Ribbon.Tab.Home.Layout" Header="{loc:Translate Layout}">
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.Home.Layout.Refresh" x:Name="refreshButton" Text="{loc:Translate Refresh}" Command="vm:XmlViewModel.RelayoutCommand" 
								   Icon="Icons\reload.ico" LargeIcon="Icons\reload.ico" SizeDefinition="Large">
                        <!--<Fluent:Button.ToolTip>
                            <Fluent:ScreenTip loc:Translate.Uid="Ribbon.Tab.Home.Layout.Refresh.ScreenTip" Title="{loc:Translate 'Refresh layout (Ctrl+R)'}" Text="{loc:Translate 'Refresh layout'}" />
                        </Fluent:Button.ToolTip>-->
                    </Fluent:Button>
                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox loc:Translate.Uid="Ribbon.Tab.Home.Validation" Header="{loc:Translate Validation}">
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.Home.Validation.ValidateXsd" Text="{loc:Translate 'Validate Xsd'}" 
								   Command="vm:XmlViewModel.ValidateXsdCommand" Icon="Icons\ok.ico" LargeIcon="Icons\ok.ico"
								   SizeDefinition="Large" Visibility="{Binding Path=ValidatingXsd, Converter={StaticResource boolToVisibilityNegativeConverter}}" />
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.Home.Validation.CancelValidateXsd" Text="{loc:Translate 'Cancel validation'}" 
								   Command="vm:XmlViewModel.CancelValidateXsdCommand" Icon="Icons\ok.ico" LargeIcon="Icons\stop.ico"
								   SizeDefinition="Large" Visibility="{Binding Path=ValidatingXsd, Converter={StaticResource boolToVisibilityPositiveConverter}}" />
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.Home.Validation.ValidateDtd" Text="{loc:Translate 'Validate DTD'}" 
								   Command="vm:XmlViewModel.ValidateDtdCommand" Icon="Icons\ok.ico" LargeIcon="Icons\ok.ico"
								   SizeDefinition="Large" Visibility="{Binding Path=ValidatingDtd, Converter={StaticResource boolToVisibilityNegativeConverter}}" />
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.Home.Validation.CancelValidateDtd" Text="{loc:Translate 'Cancel validation'}" 
								   Command="vm:XmlViewModel.CancelValidateDtdCommand" Icon="Icons\ok.ico" LargeIcon="Icons\stop.ico"
								   SizeDefinition="Large" Visibility="{Binding Path=ValidatingDtd, Converter={StaticResource boolToVisibilityPositiveConverter}}" />
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.Home.Validation.CheckXsd" Text="{loc:Translate 'Check Xsd'}" 
								   Command="vm:XsdViewModel.CheckXsdCommand" Icon="Icons\ok.ico" LargeIcon="Icons\ok.ico"
								   SizeDefinition="Large" />
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.Home.Validation.AttachDtd" Text="{loc:Translate 'Attach DTD'}"
                                   Command="vm:XmlViewModel.AttachDtdCommand" Icon="Icons\attach.ico" LargeIcon="Icons\attach.ico" SizeDefinition="Large" />
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.Home.Validation.RemoveDtd" Text="{loc:Translate 'Remove DTD'}"
                                   Command="vm:XmlViewModel.RemoveDtdCommand" Icon="Icons\cancel.ico" LargeIcon="Icons\cancel.ico" SizeDefinition="Large" />
                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox loc:Translate.Uid="Ribbon.Tab.Home.Xml" Header="{loc:Translate Xml}">
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.Home.Xml.CreateRootElement" Text="{loc:Translate 'Create root element'}"
                                    Command="vm:XmlViewModel.CreateRootElementCommand" Icon="Icons\filenew.ico" LargeIcon="Icons\filenew.ico" SizeDefinition="Large" />
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.Home.Xml.ExpandAll" Text="{loc:Translate 'Expand all'}"
                                   Command="vm:XmlViewModel.ExpandAllCommand" Icon="Icons\2dowarrow.ico" LargeIcon="Icons\2dowarrow.ico" SizeDefinition="Large" />
                </Fluent:RibbonGroupBox>

                <!--<Fluent:RibbonGroupBox loc:Translate.Uid="Ribbon.Tab.Home.XPath" Header="{loc:Translate XPath}">
					<Grid>
						<Grid.ColumnDefinitions>
							<ColumnDefinition />
							<ColumnDefinition />
							<ColumnDefinition />
						</Grid.ColumnDefinitions>
						<TextBlock Grid.Column="0" loc:Translate.Uid="Ribbon.Tab.Home.XPath.Text" Text="{loc:Translate 'XPath:'}" Margin="3" />
						<Fluent:TextBox Grid.Column="1" x:Name="XPathTextBox" Width="80" />
						<Button x:Name="btnXPath" Grid.Column="2" Margin="3" loc:Translate.Uid="Ribbon.Tab.Home.XPath.SelectButton" Content="{loc:Translate 'Select nodes'}" 
								Command="vm:XmlViewModel.SelectNodesCommand" CommandParameter="{Binding ElementName=XPathTextBox, Path=Content}" />
					</Grid>

				</Fluent:RibbonGroupBox>-->

                <!-- Graph info -->
                <!--<Fluent:RibbonGroupBox loc:Translate.Uid="Ribbon.Tab.Layout.Info" Header="{loc:Translate Info}">
                    <Grid Margin="2">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="5" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="5" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="5" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <TextBlock Grid.Row="0" Grid.Column="0" Width="Auto" Height="Auto" Margin="2" Text="Vertices:" TextWrapping="Wrap" VerticalAlignment="Center" />
                        <TextBlock Grid.Row="0" Grid.Column="2" Width="Auto" Height="Auto" Margin="2" Text="{Binding Path=VertexCount}" TextWrapping="Wrap" VerticalAlignment="Center" />

                        <TextBlock Grid.Row="1" Grid.Column="0" Width="Auto" Height="Auto" Margin="2" Text="Edges:" TextWrapping="Wrap" VerticalAlignment="Center" />
                        <TextBlock Grid.Row="1" Grid.Column="2" Width="Auto" Height="Auto" Margin="2" Text="{Binding Path=EdgeCount}" TextWrapping="Wrap" VerticalAlignment="Center" />

                        <TextBlock Text="Computation Time" TextWrapping="Wrap" Grid.Row="2" Grid.Column="0" />
                        <TextBlock Text="{Binding Path=LayoutState.ComputationTime, ElementName=graphLayout}" Grid.Row="2" Grid.Column="2" />

                        <TextBlock Grid.Row="0" Grid.Column="4" Width="Auto" Height="Auto" Margin="2" Text="Keys" TextWrapping="Wrap" VerticalAlignment="Center" />
                        <TextBlock Grid.Row="0" Grid.Column="6" Width="Auto" Height="Auto" Margin="2" Text="{Binding Path=KeyCount}" TextWrapping="Wrap" VerticalAlignment="Center" />
                    </Grid>
                </Fluent:RibbonGroupBox>-->

                <!-- Clipboard -->
                <!--<Fluent:RibbonGroupBox Header="Clipboard">
					<Fluent:SplitButton x:Name="ss" Fluent:KeyTip.Keys="V" Text="Paste" Icon="Images\Paste.png" LargeIcon="Images\PasteLarge.png" SizeDefinition="Large">
						<Fluent:SplitButton.ToolTip>
							<Fluent:ScreenTip
								  Title="Paste (Ctrl+V)"
								  Text="Paste the contents of the Clipboard."
								  Width="190"/>
						</Fluent:SplitButton.ToolTip>
						<Fluent:Gallery VerticalScrollBarVisibility="Hidden" Orientation="Horizontal" GroupBy="Tag" Selectable="False" ItemWidth="32" ItemHeight="32">
							<Image Source="Images\PasteImage.png" Width="24" Height="24" Fluent:KeyTip.Keys="K" Tag="Paste Options:"/>
							<Image Source="Images\PasteText.png" Width="24" Height="24" Fluent:KeyTip.Keys="M" Tag="Paste Options:"/>
							<Image Source="Images\PasteTextOnly.png" Width="24" Height="24" Fluent:KeyTip.Keys="T" Tag="Paste Options:"/>
							<Image Source="Images\PasteFormating.png" Width="24" Height="24" Fluent:KeyTip.Keys="L" Tag="Paste Options:"/>
							<Image Source="Images\PasteSourceFormating.png" Width="24" Height="24" Fluent:KeyTip.Keys="E" Tag="Paste Options:"/>
						</Fluent:Gallery>
						<Fluent:MenuItem Text="Paste Special..." Fluent:KeyTip.Keys="S">
							<Fluent:MenuItem.ToolTip>
								<Fluent:ScreenTip Title="Paste Special"                                  
								  Text="This ScreenTip is attached to menu item"/>
							</Fluent:MenuItem.ToolTip>
						</Fluent:MenuItem>
						<Fluent:MenuItem Text="Set Default Paste..." Fluent:KeyTip.Keys="A">
							<Fluent:MenuItem Text="1"></Fluent:MenuItem>
							<Fluent:MenuItem Text="2"></Fluent:MenuItem>
						</Fluent:MenuItem>
					</Fluent:SplitButton>
					<Fluent:Button x:Name="ssd" IsEnabled="False" Fluent:KeyTip.Keys="X" Text="Cut" Icon="Images\Cut.png" SizeDefinition="Middle,Small">
						<Fluent:Button.ToolTip>
							<Fluent:ScreenTip
			   Title="Cut (Ctrl+X)"
			   Text="Cut the contents to the Clipboard."
			   Width="190"/>
						</Fluent:Button.ToolTip>
					</Fluent:Button>
					<Fluent:Button IsEnabled="False" Fluent:KeyTip.Keys="C" Text="Copy" Icon="Images\Copy.png" SizeDefinition="Middle,Small"/>
					<Fluent:Button Fluent:KeyTip.Keys="FP" Text="Format Painter" Icon="Images\FormatPainter.png" SizeDefinition="Middle,Small"/>
				</Fluent:RibbonGroupBox>-->
            </Fluent:RibbonTabItem>

            <!-- Layout -->
            <Fluent:RibbonTabItem loc:Translate.Uid="Ribbon.Tab.Layout" Header="{loc:Translate Layout}" x:Name="layoutTab">
                <!-- Layout Algorithm -->
                <Fluent:RibbonGroupBox loc:Translate.Uid="Ribbon.Tab.Layout.LayoutAlgorithm" Header="{loc:Translate 'Layout Algorithm'}">
                    <Fluent:InRibbonGallery ItemsSource="{Binding Path=LayoutAlgorithmFactory.AlgorithmTypes, ElementName=graphLayout}"
									SelectedItem="{Binding Path=LayoutAlgorithmType}"
									ItemTemplate="{DynamicResource AlgorithmTypeTemplate}"
									ItemsInRow="2" MinItemsInRow="2" MaxItemsInRow="3" 
									ItemHeight="56" ItemWidth="40"
									SizeDefinition="Large" Orientation="Horizontal" CanCollapseToButton="False" ResizeMode="Both"
									Width="Auto" MinWidth="90">
                    </Fluent:InRibbonGallery>
                    <!--<Fluent:InRibbonGallery MinItemsInRow="1" MaxItemsInRow="1"
						ItemTemplate="{DynamicResource AlgorithmTypeTemplate}"
						ItemsSource="{Binding Path=LayoutAlgorithmFactory.AlgorithmTypes, ElementName=graphLayout}"
						ResizeMode="Vertical" SelectedItem="{Binding Path=LayoutAlgorithmType}" />-->
                    <!--<ComboBox ItemsSource="{Binding Path=LayoutAlgorithmFactory.AlgorithmTypes, ElementName=graphLayout}" 
							  SelectedItem="{Binding Path=LayoutAlgorithmType}" />-->
                </Fluent:RibbonGroupBox>

                <!-- Layout -->
                <Fluent:RibbonGroupBox loc:Translate.Uid="Ribbon.Tab.Layout.Layout" Header="{loc:Translate Layout}">
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.Layout.Refresh.Refresh" Text="{loc:Translate Refresh}" Command="vm:XmlViewModel.RelayoutCommand" Icon="Icons\reload.ico" LargeIcon="Icons\reload.ico" SizeDefinition="Large">
                        <!--<Fluent:Button.ToolTip>
                            <Fluent:ScreenTip loc:Translate.Uid="Ribbon.Tab.Layout.Refresh.Refresh.ScreenTip" Title="{loc:Translate 'Refresh layout (Ctrl+R)'}" Text="{loc:Translate 'Refresh layout'}" />
                        </Fluent:Button.ToolTip>-->
                    </Fluent:Button>
                </Fluent:RibbonGroupBox>

                <Fluent:RibbonGroupBox loc:Translate.Uid="Ribbon.Tab.Layout.Parameters" Header="{loc:Translate Parameters}">
                    <StackPanel Grid.Column="1" Grid.Row="1" Margin="10,0" Orientation="Horizontal">
                        <GroupBox loc:Translate.Uid="Ribbon.Tab.Layout.Parameters.LayoutAlgorithmParameters" Header="{loc:Translate 'Layout algorithm parameters'}" 
                                  Content="{Binding Path=LayoutParameters, ElementName=graphLayout}" />
                        <GroupBox loc:Translate.Uid="Ribbon.Tab.Layout.Parameters.OverlapRemovalParameters" Header="{loc:Translate 'Overlap removal parameters'}"
                                  Content="{Binding Path=OverlapRemovalParameters, ElementName=graphLayout}" />
                        <!--<GroupBox Header="Edge routing parameters" Content="{Binding Path=EdgeRoutingParameters, ElementName=graphLayout}" />-->
                    </StackPanel>
                </Fluent:RibbonGroupBox>

                <!-- Overlap Removal -->
                <!--<Fluent:RibbonGroupBox loc:Translate.Uid="Ribbon.Tab.Layout.OverlapRemoval" Header="{loc:Translate 'Overlap Removal'}">
					<Fluent:InRibbonGallery MinItemsInRow="1" MaxItemsInRow="1"                        
						ItemTemplate="{DynamicResource OverlapRemovalTemplate}"
						ItemsSource="{Binding Source={StaticResource algorithmConstraintEnum}}"
						ResizeMode="Vertical" SelectedItem="{Binding Path=OverlapRemovalConstraint, ElementName=graphLayout}" />
				</Fluent:RibbonGroupBox>-->

                <!-- Overlap Removal Algorithm -->
                <!--<Fluent:RibbonGroupBox loc:Translate.Uid="Ribbon.Tab.Layout.OverlapRemovalAlgorithm" Header="{loc:Translate 'Overlap Removal Algorithm'}">
					<Fluent:InRibbonGallery MinItemsInRow="1" MaxItemsInRow="1"                        
						ItemTemplate="{DynamicResource OverlapRemovalAlgorithmTemplate}"
						ItemsSource="{Binding Path=OverlapRemovalAlgorithmFactory.AlgorithmTypes, ElementName=graphLayout}"
						ResizeMode="Vertical" SelectedItem="{Binding Path=OverlapRemovalAlgorithmType, ElementName=graphLayout}" />
				</Fluent:RibbonGroupBox>-->
            </Fluent:RibbonTabItem>

            <Fluent:RibbonTabItem x:Name="XmlTools" IsSelected="{Binding XmlToolsSelected, Mode=OneWay}" loc:Translate.Uid="Ribbon.Tab.XmlTools" Header="{loc:Translate 'XML tools'}" 
                                  Group="{Binding ElementName=ToolsGroup}">
                <Fluent:RibbonGroupBox loc:Translate.Uid="Ribbon.Tab.XmlTools.XmlEditing" Header="{loc:Translate XML}">
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.XmlTools.Edit" Text="{loc:Translate Edit}" Command="vm:XmlViewModel.EditXmlNodeCommand"
                                   Icon="Icons\edit.ico" LargeIcon="Icons\edit.ico" SizeDefinition="Large" />
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.XmlTools.AddChildElement" Text="{loc:Translate 'Add child element'}" Command="vm:XmlViewModel.AddChildElementCommand"
                                   Icon="Icons\add_user.ico" LargeIcon="Icons\add_user.ico" SizeDefinition="Large" />
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.XmlTools.AddChildTextNode" Text="{loc:Translate 'Add child text node'}" Command="vm:XmlViewModel.AddChildTextNodeCommand"
                                   Icon="Icons\mail_new.ico" LargeIcon="Icons\mail_new.ico" SizeDefinition="Large" />
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.XmlTools.RemoveNode" Text="{loc:Translate 'Remove node'}" Command="vm:XmlViewModel.RemoveNodeCommand"
                                   Icon="Icons\edit_remove.ico" LargeIcon="Icons\edit_remove.ico" SizeDefinition="Large" />
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.XmlTools.ExpandWithSubtree" Text="{loc:Translate 'Expand with subtree'}" Command="vm:XmlViewModel.ExpandNodeWithSubtreeCommand"
                                   Icon="Icons\edit_add.ico" LargeIcon="Icons\edit_add.ico" SizeDefinition="Large" />
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.XmlTools.SelectForCopying" Text="{loc:Translate 'Select for copying'}" Command="vm:XmlViewModel.SelectSubtreeForCopyingCommand"
                                   Icon="Icons\editcopy.ico" LargeIcon="Icons\editcopy.ico" SizeDefinition="Large" />
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.XmlTools.SelectForMoving" Text="{loc:Translate 'Select for moving'}" Command="vm:XmlViewModel.SelectSubtreeForMovingCommand"
                                   Icon="Icons\editcut.ico" LargeIcon="Icons\editcut.ico" SizeDefinition="Large" />
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.XmlTools.Paste" Text="{loc:Translate 'Paste'}" Command="vm:XmlViewModel.PasteSubtreeCommand"
                                   Icon="Icons\editpaste.ico" LargeIcon="Icons\editpaste.ico" SizeDefinition="Large" />
                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox loc:Translate.Uid="Ribbon.Tab.XmlTools.Appearance" Header="{loc:Translate Appearance}">
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.XmlTools.Appearance.ChangeColor" Text="{loc:Translate 'Change color'}" Command="vm:XmlViewModel.ChangeColorCommand"
                                   Icon="Icons\appearance.ico" LargeIcon="Icons\appearance.ico" SizeDefinition="Large" />
                    <Fluent:Button loc:Translate.Uid="Ribbon.Tab.XmlTools.Appearance.ChangeShape" Text="{loc:Translate 'Change shape'}" Command="vm:XmlViewModel.ChangeAppearanceCommand"
                                   Icon="Icons\bookmark_toolbar.ico" LargeIcon="Icons\bookmark_toolbar.ico" SizeDefinition="Large" />
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>

            <!--Contextual Tab Groups-->
            <Fluent:Ribbon.ContextualGroups>
                <Fluent:RibbonContextualTabGroup loc:Translate.Uid="Ribbon.ContextualGroups.Tools" Header="{loc:Translate 'Tools'}" Visibility="{Binding XmlToolsVisible}"
                                                 x:Name="ToolsGroup" Background="Green" BorderBrush="Green" />
            </Fluent:Ribbon.ContextualGroups>

            <!--Backstage Items-->
            <Fluent:Ribbon.BackstageItems>
                <Fluent:Button loc:Translate.Uid="Ribbon.Backstage.Save" x:Name="SaveButtonBackstage" Text="{loc:Translate Save}" IsDefinitive="True" Command="vm:XmlViewModel.SaveDocumentCommand" Icon="Icons\filesave.ico" />
                <Fluent:Button loc:Translate.Uid="Ribbon.Backstage.SaveAs" Text="{loc:Translate 'Save As'}" IsDefinitive="True" Command="vm:XmlViewModel.SaveDocumentAsCommand" Icon="Icons\filesaveas.ico" />
                <Fluent:Button loc:Translate.Uid="Ribbon.Backstage.Open" Text="{loc:Translate Open}" Command="Open" IsDefinitive="True" Icon="Icons\fileopen.ico" />
                <Fluent:Button loc:Translate.Uid="Ribbon.Backstage.Close" Text="{loc:Translate Close}" Command="Close" IsDefinitive="True" />
                <Fluent:BackstageTabItem loc:Translate.Uid="Ribbon.Backstage.Tab.New" Header="{loc:Translate New}">
                    <Grid>
                        <Grid.Resources>
                            <!-- Change the default Fluent:Button's style -->
                            <Style x:Key="{x:Type Fluent:Button}" TargetType="{x:Type Fluent:Button}" BasedOn="{StaticResource XmlStudioBackstageButtonStyle}">
                                <Setter Property="Template" Value="{DynamicResource XmlStudioBackstageButtonControlTemplate}" />
                            </Style>
                        </Grid.Resources>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition MinWidth="150" MaxWidth="811" />
                            <ColumnDefinition MinWidth="150" />
                        </Grid.ColumnDefinitions>

                        <Grid Grid.Column="0" Margin="28,25,12,28">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <TextBlock loc:Translate.Uid="Ribbon.Backstage.Tab.New.AvailableTemplates" Text="{loc:Translate 'Available Templates'}" Grid.Row="0" FontSize="15" />
                            <Border Style="{StaticResource HorizontalSeparatorStyle}" Grid.Row="1"  />
                            <StackPanel Grid.Row="2" Orientation="Horizontal">
                                <!--<Fluent:ToggleButton IsDefinitive="True" Text="Blank xml document" Command="New" CommandParameter="xml" SizeDefinition="Large" LargeIcon="Icons/filenew.ico" Icon="Icons/filenew.ico" />-->
                                <Fluent:Button loc:Translate.Uid="Ribbon.Backstage.Tab.New.BlankXml" IsDefinitive="True" Text="{loc:Translate 'Blank xml document'}" 
                                               Command="New" CommandParameter="xml" SizeDefinition="Large" LargeIcon="Icons/filenew.ico" Icon="Icons/filenew.ico" />
                                <Fluent:Button loc:Translate.Uid="Ribbon.Backstage.Tab.New.BlankXsd" IsDefinitive="True" Text="{loc:Translate 'Blank xsd document'}"
                                               Command="New" CommandParameter="xsd" SizeDefinition="Large" LargeIcon="Icons/filenew.ico" Icon="Icons/filenew.ico" />
                            </StackPanel>
                        </Grid>
                    </Grid>
                </Fluent:BackstageTabItem>
                <Fluent:Button x:Name="PrintButton" loc:Translate.Uid="Ribbon.Backstage.Print" Icon="Icons\fileprint.ico" Text="{loc:Translate Print}" Command="Print" IsDefinitive="True" />
                <Fluent:Button loc:Translate.Uid="Ribbon.Backstage.Export" Text="{loc:Translate Export}" Command="vm:XmlViewModel.ExportCommand" IsDefinitive="true" />
                <Fluent:Button Text="{loc:Translate Options}" loc:Translate.Uid="Ribbon.Backstage.Options" Command="vm:XmlViewModel.SettingsCommand" IsDefinitive="True" />
                <Fluent:Button loc:Translate.Uid="Ribbon.Backstage.Exit" Text="{loc:Translate Exit}" Command="vm:XmlViewModel.ExitCommand" />
            </Fluent:Ribbon.BackstageItems>
        </Fluent:Ribbon>

        <!-- XPath bar -->
        <DockPanel Grid.Row="1" Margin="11 0 11 0">
            <TextBlock Height="{StaticResource TextBlockHeight}" DockPanel.Dock="Left" loc:Translate.Uid="XPathTitle" Text="{loc:Translate 'XPath expression:'}" />
            <Button DockPanel.Dock="Right" x:Name="btnXPath" HorizontalAlignment="Right" Grid.Column="2" MinWidth="{StaticResource ButtonWidth}" Height="{StaticResource ButtonHeight}" 
					Margin="7 7 0 7" loc:Translate.Uid="Ribbon.Tab.Home.XPath.SelectButton" Content="{loc:Translate 'Select'}" 
					Command="vm:XmlViewModel.SelectNodesCommand" CommandParameter="{Binding ElementName=XPathTextBox, Path=Text}" />
            <TextBox Grid.Column="1" x:Name="XPathTextBox" Margin="{StaticResource TextBoxMargin}" Height="{StaticResource TextBoxHeight}" DockPanel.Dock="Top" />
        </DockPanel>

        <!-- Tabs -->
        <TabControl Grid.Row="2" Name="mainTabControl" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TabStripPlacement="Top" Margin="11 0 11 11">
            <TabItem Width="Auto" loc:Translate.Uid="Tab.Designer" Height="Auto" Header="{loc:Translate Designer}" BorderBrush="Gray" BorderThickness="1">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <ScrollViewer x:Name="svCanvas" Grid.Row="0" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Focusable="False">
                        <ScrollViewer.Background>
                            <SolidColorBrush Color="{Binding Source={StaticResource Settings}, Path=Default.canvasBackgroundColor}" />
                        </ScrollViewer.Background>
                        <Controls:DesignerCanvas x:Name="designerCanvas" Focusable="True" ContextMenu="{Binding RootContextMenu, Mode=OneWay}">
                            <!--ContextMenu="{Binding RootContextMenu, Mode=OneWay}"-->
                            <Controls:DesignerCanvas.Background>
                                <SolidColorBrush Color="{Binding Source={StaticResource Settings}, Path=Default.canvasBackgroundColor}" />
                            </Controls:DesignerCanvas.Background>
                            <Controls:DesignerCanvas.LayoutTransform>
                                <ScaleTransform ScaleX="{Binding Path=Value, ElementName=zoomSlider}" ScaleY="{Binding Path=Value, ElementName=zoomSlider}"
												CenterX="{Binding Path=HorizontalOffset, ElementName=svCanvas}" CenterY="{Binding Path=VerticalOffset, ElementName=svCanvas}" />
                            </Controls:DesignerCanvas.LayoutTransform>
                            <Border x:Name="ExportArea" Padding="10" Background="White">
                                <vm:XmlGraphLayout x:Name="graphLayout" Graph="{Binding Path=Graph}" LayoutAlgorithmType="{Binding Path=LayoutAlgorithmType}"
								vm:LayoutManager.ManagedLayout="True" OverlapRemovalAlgorithmType="FSA" HighlightAlgorithmType="Simple" AsyncCompute="false" IsAnimationEnabled="false">
                                </vm:XmlGraphLayout>
                            </Border>
                        </Controls:DesignerCanvas>
                    </ScrollViewer>
                    <DockPanel Grid.Row="1" Margin="11 0 11 0">
                        <Slider x:Name="zoomSlider" IsSnapToTickEnabled="True" TickPlacement="None" AutoToolTipPrecision="2" Margin="0 5 5 5"
								Minimum="0.1" Maximum="4" Value="1" Width="100" TickFrequency="0.05" ValueChanged="zoomSlider_ValueChanged" />
                        <TextBox UndoLimit="0" Height="{StaticResource TextBoxHeight}" Width="50" Margin="5" Text="{Binding ElementName=zoomSlider, Path=Value, Mode=TwoWay, Converter={StaticResource zoomConverter}, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" />
                        <TextBlock Width="50" Margin="5" Height="{StaticResource TextBlockHeight}" Text="{Binding Mode, Mode=OneWay}" HorizontalAlignment="Left" />
                    </DockPanel>
                </Grid>
            </TabItem>
            <TabItem loc:Translate.Uid="Tab.Code" Header="{loc:Translate Source Code}">
                <Grid>
                    <TextBox Name="xmlcode" Text="{Binding RawXml}" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" IsReadOnly="True" />
                </Grid>
            </TabItem>
        </TabControl>

        <!-- GridSplitter -->
        <GridSplitter Grid.Row="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />

        <!-- StatusBar -->
        <Grid Grid.Row="4">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <TabControl HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TabStripPlacement="Top" Margin="11 0 11 11">
                <TabItem loc:Translate.Uid="Tab.StatusBar" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Header="{loc:Translate 'Status'}" BorderBrush="Gray" BorderThickness="1">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        
                        <TextBox UndoLimit="0" x:Name="StatusTextBox" IsReadOnly="True" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
							  TextChanged="OnStatusTextBoxTextChanged" />
                        
                        <ProgressBar x:Name="ProgressBar" Grid.Row="1" Height="22" Width="200" HorizontalAlignment="Left" Visibility="Collapsed" />
                    </Grid>
                </TabItem>
            </TabControl>
        </Grid>
    </Grid>
</Fluent:RibbonWindow>